package com.zh.sharding.sale.entity;

import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Objects;

/**
 * 用户
 * 使用自定义ID
 * 分片规则：按username hash分片
 * @author zhou
 * @date 2023/8/23
 */
@Data
public class User implements Serializable {
    /**
     * 使用自定义ID
     */
    private Long id;
    private String username;
    private String phone;
    private String cardNumber;

    private LocalDateTime createTime;

    User(){}

    public User(String username,String phone,String cardNumber) {
        Objects.requireNonNull(username);
        Objects.requireNonNull(phone);
        Objects.requireNonNull(cardNumber);

        this.username = username;
        this.phone = phone;
        this.cardNumber = cardNumber;
        this.createTime = LocalDateTime.now();
    }
}
